<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<div class="bjui-pageHeader" style="background-color:#fefefe; border-bottom:none;">
    <form data-toggle="ajaxsearch"
          data-options="{searchDatagrid:$.CurrentNavtab.find('#loanFirstCheckTable')}">
        <fieldset>
            <legend style="font-weight:normal;">搜索：</legend>

            <div class="bjui-row col-3">
                <label class="row-label">标的名称:</label>
                <div class="row-input">
                    <input type="text" name="fullName" class="form-control" size="30" title="标的名称">
                </div>

                <label class="row-label">标的编号：</label>
                <div class="row-input">
                    <input type="text" name="loanNumber" class="form-control" size="30" title="标的编号">
                </div>

                <label class="row-label">借款人用户名：</label>
                <div class="row-input">
                    <input type="text" name="userName" class="form-control" size="30" title="借款人用户名">
                </div>

                <label class="row-label">发布时间：</label>
                <div class="row-input">
                    <input type="text" name="dateFromTo.from" data-toggle="datepicker" data-nobtn="true" size="14">
                    -
                    <input type="text" name="dateFromTo.to" data-toggle="datepicker" data-nobtn="true" size="14">
                </div>

                <label class="row-label"></label>
                <div class="row-input">
                    <div class="btn-group">
                        <button type="submit" class="btn-green" data-icon="search">搜索</button>
                        <button type="reset" class="btn-orange" data-icon="times">重置</button>
                    </div>
                </div>

            </div>
        </fieldset>
    </form>
</div>
<div class="bjui-pageContent">
    <table id="loanFirstCheckTable" class="table table-bordered">
    </table>
</div>

<script type="text/javascript" src="/js/toolDate.js"></script>
<script type="text/javascript" src="/js/loan/loanDisplay.js"></script>
<script type="text/javascript">
    $(function () {
        var columns = defaultColumns;
        columns.push({
            label: "操作",
            align: "center",
            render: function (value, data) {
                if (data.loan === undefined) {
                    return '';
                }
                var checkButton = '<button type="button" class="btn-green" onclick="check(\'' + data.loan.loanId + '\');">审核</button>';
                return checkButton;
            }
        });
        $("#loanFirstCheckTable").datagrid({
            height: '100%',
            width: '100%',
            fullGrid : true,
            showToolbar: false,
            filterThead: false,
            dataUrl: '/admin/loan/loan/ajax/firstCheck',
            local: "remote",
            inlineEditMult: false,
            delConfirm: true,
            columns: columns,
            paging: {pageSize: 20, pageIndex: 1},
            linenumberAll: true
        });
    });

    function check(loanId) {
        if (!loanId) return;

        var openURL = "/admin/loan/loancheck/first?loanId=" + loanId;

        BJUI.dialog({
            id: 'loanFirstCheck',
            url: openURL,
            title: '${applicationScope.loanCheckTypeMap["1"]}',
            resizeable: true,
            fresh: true,
            onClose: function () {
                BJUI.navtab('refresh');
            }
        });
    }
</script>